package com.it.tydic.estate.module.controller.khgl;

import com.it.tydic.estate.common.annotation.ControllerDesc;
import com.it.tydic.estate.common.aop.Result;
import com.it.tydic.estate.common.constants.LogConstants;
import com.it.tydic.estate.module.model.Vo.ReturnObjectVo;
import com.it.tydic.estate.module.model.inner.TbCustomerEvents;
import com.it.tydic.estate.module.model.inner.TbFamily;
import com.it.tydic.estate.module.service.impl.CustomerEventsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @description:    客户事件管理
 * @author: liuhui
 * @createDate: 2020/3/5
 * @version: 1.0
 */
@RestController
@RequestMapping("customerEvents")
@Api(tags = "客户事件管理")
public class CustomerEventsController {
    @Autowired
    private CustomerEventsServiceImpl customerEventsService;  /*事件*/
    /**
     * 客户事件列表查询
     * @return
     */
    @PostMapping("/selectListEvents")
    @ApiOperation(value = "客户事件管理列表查询", notes = "客户事件管理列表查询")
    public Result selectListEvents(@RequestBody Map<String,Object> map){
        return customerEventsService.selectListEvents(map);
    }
    /**
     * 客户事件详情
     * @return
     */
    @GetMapping("/getById/{uid}")
    @ApiOperation(value = "客户事件详情", notes = "客户事件详情")
    public Result getById(@RequestParam String uid){
        return customerEventsService.getById(uid);
    }

    /**
     * 客户事件添加修改
     * @param tbCustomerEvents
     * @return
     */
    @PostMapping("/addEvents")
    @ControllerDesc(description = LogConstants.addOrUpdate_data)
    @ApiOperation(value = "客户事件添加修改", notes = "客户事件添加修改")
    public Result addEvents(@RequestBody TbCustomerEvents tbCustomerEvents){
        return customerEventsService.addEvents(tbCustomerEvents);
    }
    /**
     * 事件删除（批量）
     * @param list
     * @return
     */
    @PostMapping("/delEvents")
    @ControllerDesc(description = LogConstants.delete_data)
    @ApiOperation(value = "事件删除", notes = "事件删除")
    public Result delEvents(@RequestBody List<String> list){
        return customerEventsService.delEvents(list);
    }
    /**
     * 获取类别
     */
    @PostMapping("/getType")
    @ApiOperation(value = "获取类型", notes = "获取类型")
    public Result getType(@RequestParam String codeId){
        return customerEventsService.getType(codeId);
    }
    /**
     * 获取管理处，楼宇，房间号
     */
    @PostMapping("/selectCascade")
    @ApiOperation(value = "获取管理处，楼宇，房间号", notes = "获取管理处，楼宇，房间号")
    public Result selectCascade(@RequestBody Map<String,String>map){
        return customerEventsService.selectCascade(map);
    }
}
